package com.k7.mobile.platform.bo.impl;

import java.util.List;

import com.k7.mobile.platform.bo.IRankingBO;
import com.k7.mobile.platform.dao.IRankingDAO;
import com.k7.mobile.platform.dataobject.GramDO;
import com.k7.mobile.platform.dataobject.RankingDO;
import com.k7.mobile.platform.exception.BOException;

public class RankingBOImpl extends BaseBOImpl implements IRankingBO{
	
	private IRankingDAO rankingDAO;

	public void setRankingDAO(IRankingDAO rankingDAO) {
		this.rankingDAO = rankingDAO;
	}

	public Long add(RankingDO rankingDO) throws BOException {
		try{ 
			Long id=rankingDAO.add(rankingDO);
			return id;
		}catch(Exception ex){
			log.error("RankingBOImpl:add,插入Ranking失败", ex);
			throw new BOException("创建禁止Ranking失败", ex);
		}
	}

	@Override
	public void delete(RankingDO rankingDO) throws BOException {
		try{
			rankingDAO.delete(rankingDO);
		}catch(Exception ex){
			log.error("RankingBOImpl:delete,删除Ranking失败", ex);
			throw new BOException("删除Ranking失败", ex);
		}
		
	}
	@Override
	public void update(RankingDO rankingDO) throws BOException {
		try{
			rankingDAO.update(rankingDO);
		}catch(Exception ex){
			log.error("RankingBOImpl:delete,更新Ranking失败", ex);
			throw new BOException("更新Ranking失败", ex);
		}
		
	}

	@Override
	public List<RankingDO> findList(RankingDO rankingDO) throws BOException {
		try{
			List<RankingDO> list = rankingDAO.findList(rankingDO);
			return list;
		}catch(Exception ex){
			log.error("RankingBOImpl:findList,批量获取Ranking信息出错", ex);
			throw new BOException("批量获取Ranking信息出错", ex);
		}
		
	}

	@Override
	public RankingDO getRanking(RankingDO rankingDO) throws BOException {
		try{

			RankingDO returnDO = rankingDAO.getRanking(rankingDO);

			return returnDO;
		}catch(Exception ex){
			log.error("RankingBOImpl:getRanking,获取Ranking信息出错", ex);
			throw new BOException("获取Ranking信息出错", ex);
		}
	}
}
